package com.yitianyigexiangfa.coap.cbor.jackson;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.cbor.CBORFactory;
import com.fasterxml.jackson.dataformat.cbor.CBORGenerator;

import java.io.ByteArrayOutputStream;

/**
 * @author Bill Lau
 * @date 2017-12-23
 */
public class JacksonMapDemo {

    protected final static ObjectMapper CBOR_MAPPER = new ObjectMapper(new CBORFactory());

    public static void main(String[] args) {
            /*
       {_"Fun": true, "Amt": -2}
       0xbf6346756ef563416d7421ff
       BF           -- Start indefinite-length map
          63        -- First key, UTF-8 string length 3
             46756e --   "Fun"
          F5        -- First value, true
          63        -- Second key, UTF-8 string length 3
             416d74 --   "Amt"
          21        -- -2
          FF        -- "break"
     */
        ByteArrayOutputStream payloadOut = new ByteArrayOutputStream();
        byte [] bytes = payloadOut.toByteArray();
        String hexData = javax.xml.bind.DatatypeConverter.printHexBinary(bytes);

    }
}
